<template>
  <div>
    <!-- 历史记录和热门搜索 -->
    <div class="his-hot" v-show="isShowHistory">
      <div class="hd">
        <h4>历史记录</h4>
        <van-icon name="delete-o" @click="clear"/>
      </div>
      <div class="bd">
          <van-tag @click="tagClick(item)" plain type="default" v-for="(item,index) in historyKeywordList" :key="index">{{item}}</van-tag>
      </div>
    </div>
    <div class="his-hot">
      <div class="hd">
        <h4>热门搜索</h4>
      </div>
      <div class="bd">
          <van-tag plain  @click="tagClick(item.keyword)" :type="item.is_hot?'danger':'default'" v-for="(item,index) in hotKeywordList" :key="index" >{{item.keyword}}</van-tag>
      </div>
    </div>
  </div>
</template>

<script>
import {clearHistorySearch} from "@/request/api"
export default {
  data() {
    return {
      isShowHistory : true
    };
  },
  props :["historyKeywordList","hotKeywordList"],
  methods : {
    tagClick(val){
      this.$emit("onSearch",val)
    },
    clear(){
      this.$toast.success('删除成功');
      setTimeout(()=>{
        this.isShowHistory = false
      },1000)
      
    }
  }
};
</script>
 
<style lang = "less" scoped>
.his-hot{
    background-color: #fff;
    padding:.066667rem;
    margin-bottom: .2rem;
    .hd{
        font-size: .186667rem;
        display: flex;
        justify-content: space-between;
    }
    .bd{
        .van-tag{
            margin: 0 .066667rem;
            margin-top: .133333rem;
            padding: .013333rem .053333rem;
            
        }
    }
}
</style>